using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using CarRentalSystem.Models;

namespace CarRentalSystem.Controllers
{
    public class CarContext:DbContext
    {
        public CarContext(DbContextOptions<CarContext> options): base(options){}
        public DbSet<CarsModel> Cars{get;set;}
        public DbSet<UserModel> User{get;set;}
        public DbSet<RecordModel> Records{get;set;}
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<CarsModel>().HasData(
                new CarsModel(){
                    CarId=1,
                    CarPhoto="www.baidu.com",
                    CarType="室外",
                    CarStaus=false
                    }
            );
            modelBuilder.Entity<UserModel>().HasData(
                new UserModel(){
                    UserId=1,
                    UserName="张三",
                    UserNumble="123456789",
                    Password="456",
                    CarNumble="闵*520520",
                    Address="福建省龙岩市闽大",
                    HomeNumble=77,
                }
            );
        }
    }
}